{load header}
<!--/H-->
    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
                        <!-- nav -->
            

            
	<div class="main-title">
        <h2>资金明细</h2>
    </div>
    <div class="cf">
     
		<!-- 高级搜索 -->
		<div class="search-form fr cf">
		<div class="sleft">
				<div class="drop-down drop-make">
					<span id="sch-sort-txt-make" class="sort-txt" data="{if $mark}{$mark}{else}0{/if}">{if $cont1}{$cont1}{else}变动类型{/if}</span>
					<i class="arrow arrow-down"></i>
					<ul id="sub-sch-menu-make" class="nav-list hidden">
						<li><a href="javascript:;" value="0">变动类型</a></li>
						<li><a href="javascript:;" value="1">收入</a></li>
						<li><a href="javascript:;" value="2">支出</a></li>
					</ul>
				</div>
                                <div class="drop-down drop-award">
                                            <span id="sch-sort-txt-award" class="sort-txt" data="{if $award}{$award}{else}0{/if}">{if $award}{$award}{else}奖励类型{/if}</span>
                                            <i class="arrow arrow-down"></i>
                                            <ul id="sub-sch-menu-award" class="nav-list hidden">
                                                    <li><a href="javascript:;" value="0">奖励类型</a></li>
                                                    <li><a href="javascript:;" value="1">注册奖励</a></li>
                                                    <li><a href="javascript:;" value="2">任务奖励</a></li>
                                                    <li><a href="javascript:;" value="3">兑换奖励</a></li>
                                                    <li><a href="javascript:;" value="4">签到奖励</a></li>
                                                    <li><a href="javascript:;" value="5">提现奖励</a></li>
                                                    <li><a href="javascript:;" value="6">推广奖励</a></li>
                                                    <li><a href="javascript:;" value="7">体验奖励</a></li>
                                            </ul>
                                </div>
				<div class="drop-down drop-user">
					<span id="sch-sort-txt" class="sort-txt" data="{if $usermark}{$usermark}{else}1{/if}">{if $cont}{$cont}{else}用户名{/if}</span>
					<i class="arrow arrow-down"></i>
					<ul id="sub-sch-menu" class="nav-list hidden">
						<li><a href="javascript:;" value="1">用户名</a></li>
						<li><a href="javascript:;" value="2">推荐人</a></li>
						<!--<li><a href="javascript:;" value="3">推荐组</a></li>-->
					</ul>
				</div>
				<input type="text" name="q" class="search-input" value="{if $name}{$name}{/if}" placeholder="请输入关键词">
				<a class="sch-btn" href="javascript:;" id="search" url=""><i class="btn-search"></i></a>
			</div>
			<div class="btn-group-click adv-sch-pannel fl">
				
                <button class="btn">高 级<i class="btn-arrowdown"></i></button>
                <div class="dropdown cf">
                	<div class="row">
                		<label>创建时间：</label>
                		<input type="text" id="time-start" name="time-start" class="text input-2x" value="{if $time_start}{$time_start}{/if}" placeholder="起始时间" /> -                		
                        <div class="input-append date" id="datetimepicker"  style="display:inline-block">
                            <input type="text" id="time-end" name="time-end" class="text input-2x" value="{if $time_end}{$time_end}{/if}" placeholder="结束时间" />
                            <span class="add-on"><i class="icon-th"></i></span>
                        </div>
                	</div>
                </div>
            </div>
		</div>
	</div>
	    
    <div class="data-table">
        <div class="data-table table-striped">
			<!-----table----->
			<table class="table table-hover">
				<thead>
				<tr>
					<th>#</th>
					<th>用户</th>
					<th>推荐人</th>
                                        <th>好友</th>
					<th>溜溜币奖励内容</th>
					<th>操作金额</th>
					<th>账户余额</th>
                                        <th>变动类型</th>
					<th>奖励类型</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
				</thead>
				<tbody>
				  <!--{loop $list $k1 $val}-->
					<tr>
						<td>{$val['id']}</td>
						<td title="{$val['user_id']}">{$val['username']}</td>
                                                <td>{$val['spread']}</td>
                                                 <td>{$val['friend_name']}</td>
                                                <td>{$val['content']}</td>
						<td>{$val['finance']}</td>
						<td>{$val['finance_balance']}</td>
						<td>{$val['type']}</td>
						<td>{$val['reward_type']}</td>
						<td>{$val['create_time']}</td>
						<td>详情</td>
					</tr>
				<!--{/loop}-->

				</tbody>
				<tfoot>
				<tr>
					<th>总计</th>
					<th>--</th>
					<th>--</th>
					<th>--</th>
                                        <th>{$T_total['finance']}</th>
					<th>{$T_total['finance_balance']}</th>
					<th>--</th>
					<th>--</th>
					<th>--</th>
					
					<th>--</th>
				</tr>
				</tfoot>
			</table>
			
			<!-----/table----->
			<!-- 分页 -->
				<div class="page">
					<div>
					{$showpage}
					<span class="rows">共 {$Total} 条记录</span>
					<a target ="_blank;" href="{eval echo site_url('finance/detail_to_excel')}?{eval echo $_SERVER['QUERY_STRING'];}" >导出结果</a>
					</div>
				</div>
		</div>
    </div>
	
	
			</div>
	</div>
<link href="{eval echo base_url()}static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="{eval echo base_url()}static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="{eval echo base_url()}static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="{eval echo base_url()}static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
$(function(){
	//搜索功能
	$("#search").click(function(){
            
		var url = $(this).attr('url');
//                alert(url);
		var status = $("#sch-sort-txt").attr("data");
                var award = $("#sch-sort-txt-award").attr("data");
		var statusmake = $("#sch-sort-txt-make").attr("data");
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
		if(status != ''){
			query += '&st=' + status ;//用户类型
        }
		if(statusmake != ''){
			query += '&stm=' + statusmake;//变动类型
        }
                if(award != ''){
                        query += '&at=' + award; //奖励类型
        }
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});

	/* 状态搜索子菜单 */
	
	$(".search-form").find(".drop-user").hover(function(){
		$("#sub-sch-menu").removeClass("hidden");
		
	},function(){
		$("#sub-sch-menu").addClass("hidden");
		
	});
        
	
	$(".search-form").find(".drop-award").hover(function(){
		$("#sub-sch-menu-award").removeClass("hidden");
		
	},function(){
		$("#sub-sch-menu-award").addClass("hidden");
		
	});
        
	$(".search-form").find(".drop-make").hover(function(){
		$("#sub-sch-menu-make").removeClass("hidden");
	},function(){
		$("#sub-sch-menu-make").addClass("hidden");
	});
        
	$("#sub-sch-menu-award li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt-award").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu-award").addClass("hidden");
		})
	});
	$("#sub-sch-menu li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu").addClass("hidden");
		})
	});
	$("#sub-sch-menu-make li").find("a").each(function(){
		$(this).click(function(){
			var text = $(this).text();
			$("#sch-sort-txt-make").text(text).attr("data",$(this).attr("value"));
			$("#sub-sch-menu-make").addClass("hidden");
		})
	});	
	
	
    //回车自动提交
    $('.search-form').find('input').keyup(function(event){
        if(event.keyCode===13){
            $("#search").click();
        }
    });

    $('#time-start').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
	    minView:2,
	    autoclose:true
    });

    $('#datetimepicker').datetimepicker({
       format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true,
        pickerPosition:'bottom-left'
    })
    
})
</script>
<!--F-->{load footer}